package com.hexiang.service.impl;

import com.alibaba.csp.sentinel.EntryType;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.hexiang.client.HelloClient;
import com.hexiang.handler.HelloBlockHandler;
import com.hexiang.service.HelloService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author h01463
 * @version 1.0
 * @date 2024/8/6 14:51
 */
@Service
public class HelloServiceImpl implements HelloService {

    @Resource
    private HelloClient helloClient;

    @Override
    @SentinelResource(value = "service.hello.sayHello", entryType = EntryType.IN, blockHandlerClass = HelloBlockHandler.class, blockHandler = "sayHello")
    public String sayHello() {
        return helloClient.sayHello();
    }

    @Override
    @SentinelResource(value = "service.hello.err", entryType = EntryType.IN, blockHandlerClass = HelloBlockHandler.class, blockHandler = "err")
    public String err() {
        return "err";
    }
}
